
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"  
                xmlns:h="http://java.sun.com/jsf/html"  
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jstl/core"
                template="./../templates/StaffTemplate.xhtml">


    <ui:define name="nav_menu">
        <f:view beforePhase="#{staffRegisterManagedBean.initView}" >
            <p:menubar model="#{staffRegisterManagedBean.staffMenuModel}"/>
        </f:view>
    </ui:define>


    <ui:define name="content">
        <h:form>
            <!-- panel for dividing web page into sections -->
            <p:panel id="panel" header="#{bundle['staffAccount.header.panel']}">  
                <p:messages id="allMessages"/>

                <h:panelGrid id="panelGridStaffCreate" columns="3"  cellpadding="5" >
                    <h:outputLabel id="staffAccountUsernameLabel" value ="#{bundle['staffAccount.username.label']}" style="font-weight: bold"/>
                    <p:inputText id="username" value="#{staffRegisterManagedBean.username}" required="true" requiredMessage="#{bundle['staffAccount.username.required']}" />
                    <p:message for="username"/>


                    <h:outputLabel id="staffAccountLastnameLabel" value ="#{bundle['staffAccount.lastname.label']}" style="font-weight: bold"/>
                    <p:inputText id="lastname" value="#{staffRegisterManagedBean.lastname}" required="true" requiredMessage="#{bundle['staffAccount.lastname.required']}"/>
                    <p:message for="lastname"/>

                    <h:outputLabel id="staffAccountFirstnameLabel" value="#{bundle['staffAccount.firstname.label']}" style="font-weight: bold"/>
                    <p:inputText id="firstname" value="#{staffRegisterManagedBean.firstname}" required="true" requiredMessage="#{bundle['staffAccount.firstname.required']}"/>
                    <p:message for="firstname"/>

                    <h:outputLabel id="staffAccountGenderLabel" value="#{bundle['staffAccount.gender.label']}" style="font-weight: bold"/>
                    <h:selectOneMenu id="gender" value="#{staffRegisterManagedBean.gender}" required="true" requiredMessage="#{bundle['staffAccount.gender.required']}">
                        <f:selectItems value="#{enumGender.listItems}"/>
                    </h:selectOneMenu>
                    <p:message for="gender"/>

                    <h:outputLabel id="staffAccountBirthdateLabel" value ="#{bundle['staffAccount.birthdate.label']}" style="font-weight: bold" />
                    <p:calendar id="birthdate" value="#{staffRegisterManagedBean.birthdate}" navigator="true" required="true" requiredMessage="#{bundle['staffAccount.birthdate.required']}" pattern="yyyy-MM-dd" >
                    </p:calendar>
                    <p:message for="birthdate"/>

                    <h:outputLabel id="staffAccountCountryLabel" value ="#{bundle['staffAccount.country.label']}" style="font-weight: bold"/>
                    <h:selectOneMenu id="country" value="#{staffRegisterManagedBean.country}" required="true" requiredMessage="#{bundle['staffAccount.country.required']}">
                        <f:selectItems value="#{enumCountry.listItems}"/>
                    </h:selectOneMenu>
                    <p:message for="country"/>

                    <h:outputLabel id="staffAccountLocaleLabel" value ="#{bundle['staffAccount.languagepreferred.label']}" style="font-weight: bold"/>
                    <h:selectOneMenu id="locale" value="#{staffRegisterManagedBean.locale}" required="true" requiredMessage="#{bundle['staffAccount.languagepreferred.required']}">
                        <f:selectItems value="#{enumLanguage.listItems}"/>
                    </h:selectOneMenu>
                    <p:message for="locale"/>

                    <h:outputLabel id="staffAccountEmailLabel" value ="#{bundle['staffAccount.email.label']}" style="font-weight: bold"/>
                    <p:inputText id="email" value="#{staffRegisterManagedBean.email}" validatorMessage="#{bundle['staffAccount.email.validatorEmailFormat']}" required="true" requiredMessage="#{bundle['staffAccount.email.required']}" />
                    <p:message for="email"/>

                    <h:outputLabel id="staffAccountEmailSecondaryLabel" value ="#{bundle['staffAccount.emailSecondary.label']}" style="font-weight: bold"/>
                    <p:inputText id="emailSecondary" value="#{staffRegisterManagedBean.emailSecondary}" validatorMessage="#{bundle['staffAccount.email.validatorEmailFormat']}">
                        <f:validator validatorId="checkValidEmail" />
                    </p:inputText>
                    <p:message for="emailSecondary"/>

                    <h:outputLabel id="staffAccountDeptLabel" value ="#{bundle['staffAccount.department.label']}" style="font-weight: bold"/>
                    <h:selectOneMenu id="dept" value="#{staffRegisterManagedBean.department}" required="true" requiredMessage="#{bundle['staffAccount.department.required']}">
                        <f:selectItems value="#{enumDepartment.listItems}"/>
                    </h:selectOneMenu>
                    <p:message for="dept"/>

                    <h:outputLabel id="staffAccountJobPositionLabel" value ="#{bundle['staffAccount.jobposition.label']}" style="font-weight: bold"/>
                    <h:selectOneMenu id="jobposition" value="#{staffRegisterManagedBean.jobPosition}" required="true" requiredMessage="#{bundle['staffAccount.jobposition.required']}">
                        <f:selectItems value="#{enumJobPosition.listItems}"/>
                    </h:selectOneMenu>
                    <p:message for="jobposition"/>

                    <h:outputLabel id="staffAccountUserRoleLabel" value ="#{bundle['staffAccount.userrole.label']}" style="font-weight: bold"/>
                    <h:selectOneMenu id="userrole" value="#{staffRegisterManagedBean.userRoleType}" required="true" requiredMessage="#{bundle['staffAccount.userrole.required']}">
                        <f:selectItems value="#{enumUserRoleType.listItems}"/>
                    </h:selectOneMenu>
                    <p:message for="userrole"/>

                    <h:outputLabel id="staffAccountJoinDateLabel" value ="#{bundle['staffAccount.joindate.label']}" style="font-weight: bold" />
                    <p:calendar id="joindate" value="#{staffRegisterManagedBean.joinDate}" navigator="true" required="true" requiredMessage="#{bundle['staffAccount.joindate.required']}" pattern="yyyy-MM-dd" />
                    <p:message for="joindate"/>

                    <h:outputLabel id="staffAccountAccessLabel" value ="#{bundle['staffAccount.accessrights.label']}" style="font-weight: bold" />
                    <h:selectManyCheckbox layout="pageDirection" required="true" requiredMessage="#{bundle['staffAccount.accessrights.required']}" id="accessRights" value="#{staffRegisterManagedBean.accessRightsList}" converter="accessRightsConverter">
                        <f:selectItems value="#{enumAccessRight.listItems}" />
                    </h:selectManyCheckbox>
                    <p:message for="accessRights"/>

                </h:panelGrid>

                <p:ajaxStatus style="width:16px;height:16px;">
                    <f:facet name="start">
                        <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif"/>
                    </f:facet>
                    <f:facet name="complete">
                        <h:outputText value="" />
                    </f:facet>
                </p:ajaxStatus>
                <p:commandButton id="staffAccountRegisterButton" value="#{bundle['staffAccount.register.button']}" update="panel" actionListener="#{staffRegisterManagedBean.registerStaff}" ajax="false"  />
                <p:commandButton id="staffAccountResetButton" value="#{bundle['staffAccount.reset.button']}" type="reset"/>
            </p:panel> 
        </h:form>
    </ui:define>
</ui:composition>

